<template>
  <div id="main">
    <div class="main-sider-shell">
      <main-sidebar @setDialogVisible="setDialogVisible()" :path="path"/>
    </div>
    <div class="main-content-shell">
      <main-topper @addItem="addItem()"/>
      <router-view class="main-content" @getPath="getPath"/>
    </div>
    <profile-mode ref="profileModel"/>
    <loading v-if="nowLoading"/>
  </div>
</template>

<script>
import MainSidebar from "@/components/MainSidebar";
import MainTopper from "@/components/MainTopper";
import ProfileMode from "@/components/ProfileModel";
import Loading from "@/components/Loading";

export default {
  components: {
    MainSidebar,
    MainTopper,
    ProfileMode,
    Loading,
  },
  data() {
    return {
      path: 0,
      dialogVisible: false,
    };
  },
  computed: {
    nowLoading() {
      return this.$store.state.nowLoading;
    },
  },
  methods: {
    getPath(data) {
      this.path = data;
    },
    setDialogVisible() {
      this.$refs.profileModel.setVisible();
    },
  },
};
</script>

<style lang="scss" scoped>
@import "@/assets/global";

#main {
  position: relative;
}

.main-sider-shell {
  float: left;
  height: 100vh;
  overflow-y: auto;
}

.main-content-shell {
  margin-left: max(25vh, $minHgt / 4);
  height: 100vh;
  overflow: auto;
}

.main-content {
  position: relative;
  width: 825px;
  margin: 20px auto;
  border-radius: 35px;
  box-shadow: -10px 10px 35px rgb(200 200 200 / 50%);
  padding: 45px 25px 10px 25px;
}
</style>
